light6 2.2.0
Loading...
Searching...
No Matches
light6


Light 6 Click

Light 6 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Mar 2026.
  • Type : I2C type

Software Support

Example Description

This example demonstrates the use of the Light 6 Click board, which measures ambient light and infrared (IR) intensity. The application initializes the device and continuously reads ALS and IR data, displaying the results via UART logging.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Light6

Example Key Functions

  • light6_cfg_setup This function initializes Click configuration structure to initial values.
    void light6_cfg_setup(light6_cfg_t *cfg)
    Light 6 configuration object setup function.
    Light 6 Click configuration object.
    Definition light6.h:231
  • light6_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t light6_init ( light6_t *ctx, light6_cfg_t *cfg );
    err_t light6_init(light6_t *ctx, light6_cfg_t *cfg)
    Light 6 initialization function.
    Light 6 Click context object.
    Definition light6.h:212
  • light6_default_cfg This function executes a default configuration of Light 6 Click board.
    err_t light6_default_cfg(light6_t *ctx)
    Light 6 default configuration function.
  • light6_get_data This function reads the raw IR data and ambient light intensity in lux based on raw ALS data.
    err_t light6_get_data ( light6_t *ctx, float *als_data, uint16_t *ir_data );
    err_t light6_get_data(light6_t *ctx, float *als_data, uint16_t *ir_data)
    Light 6 Get Processed Data function.

Application Init

Initializes the logger and configures the Light 6 Click board. It establishes I2C communication and applies the default configuration settings.

void application_init ( void )
{
log_cfg_t log_cfg;
light6_cfg_t light6_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
light6_cfg_setup( &light6_cfg );
LIGHT6_MAP_MIKROBUS( light6_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == light6_init( &light6, &light6_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( LIGHT6_ERROR == light6_default_cfg ( &light6 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define LIGHT6_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition light6.h:199
@ LIGHT6_ERROR
Definition light6.h:249
void application_init(void)
Definition main.c:31

Application Task

Continuously reads ambient light and infrared sensor data and logs the results in lux and raw IR values, respectively. The readings are updated every 200ms.

void application_task ( void )
{
float als_data = 0;
uint16_t ir_data = 0;
if ( LIGHT6_OK == light6_get_data ( &light6, &als_data, &ir_data ) )
{
log_printf ( &logger, " ALS Data: %.1f lux\r\n", als_data );
log_printf ( &logger, " IR Data: %u\r\n\n", ir_data );
Delay_ms ( 200 );
}
}
@ LIGHT6_OK
Definition light6.h:248
void application_task(void)
Definition main.c:67

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.